$(function(){
	var $backtop = $('.backtop');

    ifHide();
    $backtop.click(function(){
        if(!$('html,body').is(':animated')){

            $('html,body').animate({
                scrollTop: '0px'
            }, 300);
        };	
    });
	$(window).scroll(function(e){
	    ifHide();
	});  

	function ifHide(){
	    var h = 200;
	    var scr_top = $(document).scrollTop();
	    if(scr_top > h){
	        $backtop.show();
	    }else{
	        $backtop.hide();
	    }
	}
});